From be151fd6f7e7860cc60bee67bab815c155e86fcd Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.net>
Date: Fri, 29 May 2026 23:05:37 +0000
Subject: feat(analytics): track umami events across core actions

Add a guarded track() wrapper (src/lib/analytics.ts) so programmatic
events no-op instead of throwing when umami is absent (localhost),
lazily loaded, or ad-blocked. Instrument the core loop (progress
increment, roulette, list filter, force refresh), the auth funnel
(log in/out, command palette), settings toggles/selects at the wrapper
level, sync/debug/feed actions, and tool/sharing actions.
---
 src/routes/user/[user]/badges/+page.svelte | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'src/routes/user/[user]/badges/+page.svelte')

diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte
index de55b456..77770498 100644
--- a/src/routes/user/[user]/badges/+page.svelte
+++ b/src/routes/user/[user]/badges/+page.svelte
@@ -861,7 +861,7 @@ const shadowHideBadge = () => {
                       />
                     </span>
                   </Dropdown>
-                  <button class="button-lined" onclick={submitBadge}
+                  <button class="button-lined" onclick={submitBadge} data-umami-event="Submit Badge"
                     >{selectedBadge
                       ? $locale().user.badges.editMode.update
                       : $locale().user.badges.editMode.add}</button
@@ -987,7 +987,12 @@ const shadowHideBadge = () => {
     >
       {$locale().user.badges.importMode.cancel}
     </button>
-    <button onclick={() => parsePost()} class="button-lined" style="float: right;">
+    <button
+      onclick={() => parsePost()}
+      class="button-lined"
+      style="float: right;"
+      data-umami-event="Parse Badge Post"
+    >
       {$locale().user.badges.importMode.fetch}
     </button>
 
-- 
cgit v1.2.3

